{extend name="../../admin/view/common/main"/}
{block name="style"}
<!--图片上传-->
<script type="text/javascript" charset="utf-8" src="__STATIC__/common/lib/webuploader/js/webuploader.js"></script>
<link href="__STATIC__/common/lib/webuploader/css/webuploader.css" type="text/css" rel="stylesheet">
<link href="__ADMIN_CSS__/main.min.css" type="text/css" rel="stylesheet">
{/block}

{block name="body"}
<ol class="breadcrumb">
	<i class="icon icon-angle-left"></i>
	<li>
		<a href="{:url('category/lists')}">分类管理</a>
	</li>
	<li>
		新增/编辑 分类
	</li>
</ol>
<form action="" method="post" class="form form-horizontal ajax-form card" id="form1">
	<input type="hidden" name="title" class="form-control" value="{$category_data['id']}" />
	<!--显示父级分类-->
	<div class="form-title">
		<h4>新增/编辑 分类</h4>
	</div>
	<div class="form-body">
		{if !empty($pid)}
		<div class="form-group">
			<label class="col-sm-2 control-label">上级分类</label>
			<div class="form-controls col-sm-8">
				<input type="text" class="form-control" value="{$parent['title']}" readonly />
				<input type="hidden" name="pid" value="{$pid}" />
			</div>
		</div>
		{/if}

		<div class="form-group">
			<label class="col-sm-2 control-label">分类名称</label>
			<div class="form-controls col-sm-8">
				<input type="text" name="title" class="form-control" value="{$category_data['title']}" />
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">分类图片</label>
			<div class="form-controls col-sm-8">
                {:single_image_upload('cover', $category_data['cover'])}
				<div class="help-block">建议尺寸：300*300px，等比例正方形图片，支持jpg、png</div>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label">排序</label>
			<div class="form-controls col-sm-8">
				<input type="text" name="sort" class="form-control" value="{$category_data['sort']}"/>
				<div class="help-block">数字越大，越靠前</div>
			</div>
		</div>
		
		<div class="form-group">
			<label class="col-sm-2 control-label">状态</label>
			<div class="form-controls radio-controls col-sm-8">
				{if $category_data['status'] == 1 || empty($category_data['id'])}
				<input type="radio" name="status" id="is_status-1" value="1" checked> 
				<label class="radio-inline" for="is_status-1">启用</label>
				<input type="radio" name="status" id="is_status-0" value="0">
				<label class="radio-inline" for="is_status-0"> 禁用</label>
				{else}
				<input type="radio" name="status" id="is_status-1" value="1"> 
				<label class="radio-inline" for="is_status-1">启用</label>
				<input type="radio" name="status" id="is_status-0" value="0" checked>
				<label class="radio-inline" for="is_status-0"> 禁用</label>
				{/if}
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label"></label>
			<div class="form-controls col-sm-8">
				<input type="submit" name="submit" value="确认提交" class="btn btn-primary" />
			</div>
		</div>
	</div>
</form>
{/block}

{block name="script"}
<script src="__JS__/main.min.js"></script>
{/block}
